package com.sias.common.exception;

import com.sias.common.result.Result;
import com.sias.common.result.ResultCodeEnum;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice
public class GlobalExceptionHandler {

//     @ExceptionHandler(Exception.class)
//     @ResponseBody
//     public Result error(){
//         return Result.build("全局异常", ResultCodeEnum.SYSTEM_ERROR);
//     }

     @ExceptionHandler(MyException.class)
     @ResponseBody
     public Result error(MyException e){
         return Result.build("全局异常",ResultCodeEnum.SYSTEM_ERROR);
     }
}
